<template>
  <div style="font-size: 12px;display: flex;line-height: 60px" >
    <div style="flex: 1">
      <span :class="collapseBtnClass" style="cursor: pointer;font-size: 18px" @click="collapse"></span>


        <el-breadcrumb separator-class="el-icon-arrow-right" style="display: inline-block;margin-left: 10px">
          <el-breadcrumb-item :to="'/'">首页</el-breadcrumb-item>
          <el-breadcrumb-item>{{ currentPathName }}</el-breadcrumb-item>
        </el-breadcrumb>

    </div>
    <el-dropdown style="width: 110px;cursor: pointer">
      <div style="display: inline-block" >
        <img :src="user.avatarUrl" alt=""
        style="width:30px;border-radius: 50%;position: relative;top: 10px;right: 5px">
        <span>{{user.nickname}}</span><i class="el-icon-arrow-down" style="margin-left: 5px"></i>
      </div>
      <el-dropdown-menu slot="dropdown" style="width: 100px;text-align: center" >
        <el-dropdown-item>个人信息</el-dropdown-item>
          <el-dropdown-item>
            <span  @click="logout" style="text-decoration: none;">退出 </span>
          </el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown>
  </div>
</template>

<script>



export default {
  name: "Header",
  props: {
    collapseBtnClass: String,
  },
  computed: {
    currentPathName() {
      return this.$store.state.currentPathName;
    }
  },
  data() {
    return {
      user: localStorage.getItem("user") ? JSON.parse(localStorage.getItem("user")) : {},
    }
  },
  methods: {
    collapse(){
      this.$emit('collapseF')
    },
    logout(){
      this.$store.commit("resetUser")
      this.$message.success("退出成功")
    }
  }
}
</script>





<style scoped>

</style>